@extends('layouts.default')
@section('content')
<?php
$ms = null;
switch ($any) {
            case 'sv': $ms = "MSSV";
                break;
            case 'cb':
            case 'tbm':
            case 'qtht': $ms = "MSCB";
                break;
}
?>
<br/>
<table width="280px" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
        <td class="tl"></td>
        <td class="tc title_login">
            Đăng nhập
        </td>
        <td class="tr"></td>
    </tr>
</table>
<table width="280px" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td class="cl">                
        </td>
        <td>
            <form name="formDangNhap" action="<?php echo URL;?>login" method="POST" onSubmit="return checkFormDangNhap(this)">	
                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" class="thongtin_login">
                    <tr>  
                        <td style="padding: 15px 10px 3px 10px;">
                            <?php echo $ms ?>:&nbsp;
                            <?php echo Form::token();?>
                            <input type="hidden" name="txtNhomQuyen" id="txtNhomQuyenId" value="<?php echo $any;?>"/>
                            <input type="text" name="txtTaiKhoan" id="txtTaiKhoanId" value="<?php echo Input::old('txtTaiKhoan');?>" style="width: 130px; height: 13px;"/>
                        </td>		  
                    </tr>
                    <tr>  
                        <td style="padding: 3px 10px 7px 10px;">
                            Mật khẩu:&nbsp;<input type="password" name="txtMatKhau" id="txtMatKhauId" value="<?php echo Input::old('txtMatKhau');?>" style="width: 130px;height: 13px;"/>
                        </td>		  
                    </tr>
                    <tr>
                        <td style="border-bottom: 1px solid #ccc" colspan="2"></td>
                    </tr>
                    <tr>  
                        <td align="center" colspan="2" style="padding: 10px 5px 15px 5px">
                            <input type="submit" name="btnDongy" id="btnDongyId" value="Đăng nhập" class="button_css"/>
                            <input type="reset" name="btnLamlai" id="btnLamlaiId" value="Làm lại" class="button_css"/>
                        </td>		    
                    </tr>
                </table>
            </form>
        </td>
        <td class="cr"></td>
    </tr> 
</table>
<table width="280px" border="0" align="center" cellpadding="0" cellspacing="0">	
    <tr> 
        <td class="bl"></td>
        <td class="bc"></td>
        <td class="br"></td>
    </tr>		   
</table>
<?php
if(Session::has('result'))
{
    if (!Session::get('result')) {
        echo "<script>alert('Tài khoản và mật khẩu không chính xác!');document.formDangNhap.txtTaiKhoan.focus();</script>";
    }
}
?>
<script type="text/javascript">
// Check thong tin khung dang nhap
function checkFormDangNhap(string)
{
    var taikhoan = trim(string.txtTaiKhoan.value);
    var matkhau = string.txtMatKhau.value;		
    var filter  = /^([a-zA-Z0-9_\.\-]){4,10}$/;			
    if ((taikhoan == "") || (taikhoan == null))
    {
        alert("Vui lòng nh\u1eadp chính xác mã số của bạn!");
        string.txtTaiKhoan.focus();
        return false;
    }				
    //Kiem tra tinh hop le cua Tai khoan
    if (filter.test(taikhoan)){			
        //Kiem tra xem co rong hay khong?
        if ((matkhau == "")||(matkhau == null))
        {
            alert("Vui lòng nh\u1eadp mật khẩu!");
            string.txtMatKhau.focus();
            return false;
        }
    } 
    else {			
        alert('Vui lòng nh\u1eadp chính xác mã số của bạn!');
        string.txtTaiKhoan.focus();				
        return false;
    }//end filter dinh danh	
    return true;
}
</script>
@stop